const router = require('koa-router')();
const perf = require('../controller/perf');
const {apiPrefix} = require('../config')
const user = require('./user')
const device = require('./device')
const tops = require('./tops')
const login = require('./login')
const iptable = require('./iptable')
const iparea = require('./iparea')
const urllist = require('./urllist')
const rfreshToken = require('./refreshToken')
const remote = require('./remote')
const hosts = require('./host')
const pings = require('./pings')
const snmp = require('./snmp')
const task = require('./task')


router.prefix(apiPrefix);//设置前缀
// 配置get路由
// router.get('/', function (ctx, next) {
//   ctx.body = 'this is a api get response!'
// })
//注册子接口路由
router.use('/hosts',hosts.routes(),pings.allowedMethods());
router.use('/pings',pings.routes(),pings.allowedMethods());
router.use('/user',user.routes(),user.allowedMethods());
router.use('/iptable',iptable.routes(),iptable.allowedMethods());
router.use('/iparea',iparea.routes(),iparea.allowedMethods());
router.use('/tops',tops.routes(),tops.allowedMethods());
router.use('/device',device.routes(),device.allowedMethods());
router.use('/login',login.routes(),login.allowedMethods());
router.use('/urllist',urllist.routes(),urllist.allowedMethods());
router.use('/refreshToken',rfreshToken.routes(),rfreshToken.allowedMethods('post'))
router.use('/remote',remote.routes(),remote.allowedMethods('post'))
router.use('/snmp',snmp.routes(),snmp.allowedMethods())
router.use('/task',task.routes(),task.allowedMethods())

module.exports = router;
